package org.halk.controller;

import org.halk.entity.Book;
import org.halk.mapper.BookMapper;
import org.halk.service.BookService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * book controller
 *
 * @Author haozhu7
 * @Date 2025/5/15 21:26
 **/
@RestController
@RequestMapping("/book")
public class BookController {

    @Resource
    public BookService bookService;


    @GetMapping("/reade")
    public String reade() throws IOException {

        this.bookService.reade();


        return "get book";
    }

    // 判断是否是章节标题，可以根据实际小说格式调整正则表达式
    private boolean isChapterHeader(String line) {
        return line.trim().startsWith("第") && (line.contains("章") || line.contains("回"));
    }


}
